package oneroom.user.zip;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import oneroom.comm.IbatisLoader;

import com.ibatis.sqlmap.client.SqlMapClient;

public class zipcode {
	private IbatisLoader 	iBatis;
	private SqlMapClient 	sqlMapper;
	
	public zipcode(){
		this.sqlMapper = iBatis.setConfig();
	} 
	
	public List getZipcode2(){
		List returnValue = new ArrayList();
		try{
			returnValue = (List)sqlMapper.queryForList("userzipcode.zipcode2");
		}catch (Exception e) {
			// TODO: handle exception
		}
		return returnValue;
	}
	public List getZipcode2(String str, String str2){
		List returnValue = new ArrayList();
		try{
			returnValue = (List)sqlMapper.queryForList("userzipcode.zipcode2");
		}catch (Exception e) {
			// TODO: handle exception
		}
		return returnValue;
	}
	public List getZipcode3(String zip_code2){
		List returnValue = new ArrayList();
		try{
			returnValue = (List)sqlMapper.queryForList("userzipcode.zipcode3",zip_code2);
		}catch (Exception e) {
			// TODO: handle exception
		}
		return returnValue;
	}
	
	public List getZipcode4(String zip_code3){
		List returnValue = new ArrayList();
		try{
			returnValue = (List)sqlMapper.queryForList("userzipcode.zipcode4",zip_code3);
		}catch (Exception e) {
			// TODO: handle exception
		}
		return returnValue;
	}
	
	public List getDong(String zip_code3,String roomkind, String charter){
		List returnValue = new ArrayList();
		HashMap param = new HashMap();
		param.put("zip_code3", zip_code3);
		param.put("roomkind",roomkind);		
		param.put("charter",charter);		
		try{
			returnValue = (List)sqlMapper.queryForList("userzipcode.zipdong",param);
		}catch (Exception e) {
			// TODO: handle exception
		}
		return returnValue;
	}
	/**
	 * 경기 서울 을 선택 하였을때 구를 뿌려준다
	 * @param zip_code1
	 * @return
	 */
	public List getGu(String zip_code1){
		List returnValue = new ArrayList();
		try{
			returnValue = (List)sqlMapper.queryForList("userzipcode.zipgu",zip_code1);
		}catch (Exception e) {
			// TODO: handle exception
		}
		return returnValue;
	}
	/**
	 * 전국을 선택 하였을 경우 도를 뿌려 준다.
	 * @return
	 */
	public List getDo(){
		List returnValue = new ArrayList();
		try{
			returnValue = (List)sqlMapper.queryForList("userzipcode.zipdo");
		}catch (Exception e) {
			// TODO: handle exception
		}
		return returnValue;
	}
	/**
	 * 경기 서울 을 선택 하였을때 동을 뿌려준다
	 * @param zip_code1
	 * @return
	 */
	public List getDongs(String zip_code4){
		List returnValue = new ArrayList();
		try{
			returnValue = (List)sqlMapper.queryForList("userzipcode.zipdings",zip_code4);
		}catch (Exception e) {
			// TODO: handle exception
		}
		return returnValue;
	}
	
	
	
	
}
